package serveurPoste;



public class BanqueInfractions {
	
	private CollectionInfractions infractions;
	private int currentid = 0;
	
	public BanqueInfractions(){
		infractions = new CollectionInfractions();
	}
	
	
	
	public Infraction trouverInfractionParId(int idInfraction){
		
		if(infractions.getListeInfraction().size()<idInfraction){		
			return null;
		}
		Infraction infractionRetour = infractions.getListeInfraction().get(idInfraction);
		
		return infractionRetour; 
		
	}
	
	public CollectionInfractions trouverInfractionsParDossier(Dossier mydossier)
	{
		CollectionInfractions reactionsRetour = new CollectionInfractions();
		
		int i=0;
		while( mydossier.getListeReaction()[i]> 0)
		{
			reactionsRetour.getListeInfraction().add(infractions.getListeInfraction().get(mydossier.getListeInfraction()[i])) ;
		}
		
		return reactionsRetour; 
		
	}
	
	public void ajouterInfraction(String infraction, int gravite)
	{
		Infraction theInfraction = new Infraction(currentid++, infraction, gravite);
		infractions.getListeInfraction().add(theInfraction);
	}
	
	public int getReactionsSize(){
		return infractions.size();
	}
	
	public CollectionInfractions getInfractionsList(){
		return infractions;
	}
	
}
